function denglu() {
	//清除原有消息
	$("#name_span").html("");
	$("#password_span").html("");
	//获取请求参数
	var name = $("#name").val().trim();
	var password = $("#password").val().trim();
	//console.log(name);
	//console.log(password);
	//检测格式
	var ok = true;//是否通过校验
	if(name==""){
		$("#name_span").html("用户名为空");
		ok = false;
	}
	if(password==""){
		$("#password_span").html("密码为空");
		ok = false;
	}
	//发送Ajax请求
	if(ok){//(通过格式检测)
		$.ajax({
			url:"user/login.do",
			type:"post",
			data:{"name":name,"password":password},
			dataType:"json",
			success:function(result){
				//result是服务器返回的JSON结果
				//{"status":xx,"msg":xx,"data":xx}
				if(result.status==0){//成功
					//将用户信息写入Cookie
					var name = result.data.user_name;
					addCookie("name",name,2);
					addCookie("ename",name,2);
					
					window.location.href="edit.html";
				}else if(result.status==1){//用户名错
					$("#name_span").html(result.msg);
				}else if(result.status==2){//密码错
					$("#password_span").html(result.msg);
				}
			},
			error:function(){
				alert("登录失败");
			}
		});
	}
}